自民党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("自民党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
library("RMeCab")
library("wordcloud")
## Loading required package: RColorBrewer
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########
公明党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("公明党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########
立憲民主党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("立憲民主党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)
## Warning in wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], :
## 民主党 could not be fit on page. It will not be plotted.

########
国民民主党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("国民民主党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 108 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########
日本維新の会
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("日本維新の会")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 108 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 107 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)
## Warning in wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], :
## いる could not be fit on page. It will not be plotted.
## Warning in wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], :
## する could not be fit on page. It will not be plotted.

########
社民党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("社民党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########
共産党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("共産党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 108 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)
## Warning in wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], :
## する could not be fit on page. It will not be plotted.

########
れいわ新選組
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("れいわ新選組")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 108 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 107 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)
## Warning in wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], :
## 太郎 could not be fit on page. It will not be plotted.

########
NHKから国民を守る党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("NHKから国民を守る党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########
幸福実現党
#キーワードでツイートを検索:searchTwitterコマンド
#検索キーワードの設定
SearchWords <- c("幸福実現党")
#検索
TwGetDF <- twListToDF(searchTwitter(SearchWords, n = 10000))
## [1] "Rate limited .... blocking for a minute and retrying up to 119 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 118 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 117 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 116 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 115 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 114 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 113 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 112 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 111 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 110 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 109 times ..."
## [1] "Rate limited .... blocking for a minute and retrying up to 108 times ..."
library("RMeCab")
library("wordcloud")
#SearchWords <- c("山梨")
#TwGetDF <- twListToDF(searchTwitter(searchString = SearchWords, #検索キーワード
# n = 1000 #取得するツイート数
#since = YYYY-MM-DD #取得する期間
#))
###単語の出現数設定。20以上での抽出結果となります。出現数は適時調整してください。#####
WordFreq <- 100
########
###単語解析######
res <- docMatrixDF(TwGetDF[, 1], pos = c("名詞", "形容詞", "動詞"))
## to make data frame
#windowsは下記コマンドで結果の文字化けを防ぐことができます。
#res <- docMatrixDF(iconv(TwGetDF[, 1], from = "utf-8", to = "cp932"), pos = c("名詞", "形容詞", "動詞"))
res <- res[row.names(res) != "[[LESS-THAN-1]]", ] #[[LESS-THAN-1]]の削除
resc <- res[row.names(res) != "[[TOTAL-TOKENS]]", ] #[[TOTAL-TOKENS]]の削除
########
###単語解析結果をデータフレーム化#####
AnalyticsFileDoc <- as.data.frame(apply(resc, 1, sum)) #単語の出現数を集計
AnalyticsFileDoc <- subset(AnalyticsFileDoc, AnalyticsFileDoc[, 1] >= WordFreq) #出現数で抽出
colnames(AnalyticsFileDoc) <- "出現数" #行名の設定
########
###タグクラウドのテキストの色を設定#####
Col <- c("#deb7a0", "#505457", "#4b61ba") #文字色の指定
########
###タグクラウドのプロット#####
par(family = "HiraKakuProN-W3") #実行でMACの文字化け防止
wordcloud(row.names(AnalyticsFileDoc), AnalyticsFileDoc[, 1], scale = c(6, .2),
random.order = T, rot.per = .15, colors = Col)

########